{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5000"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import json\n",
    "\n",
    "with open('./id_list_merged.ison', 'r') as f:\n",
    "    id_list = json.load(f)\n",
    "\n",
    "len(id_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 10/10 [00:00<00:00, 63.64it/s]\n"
     ]
    }
   ],
   "source": [
    "# number, model_url\n",
    "import pandas as pd\n",
    "from tqdm import tqdm\n",
    "batch = 10\n",
    "start_idx, end_idx = 0, 100\n",
    "for i in tqdm(range(start_idx, end_idx, batch)):\n",
    "    data_batch = {\n",
    "        \"number\": [],\n",
    "        \"model_url\": [],\n",
    "        \"model_name\": [],\n",
    "    }\n",
    "    for j in range(i, i+batch):\n",
    "        number = j + 1\n",
    "        model_url = f\"https://huggingface.co/{id_list[j]}\"\n",
    "        data_batch[\"number\"].append(number)\n",
    "        data_batch[\"model_url\"].append(model_url)\n",
    "        data_batch[\"model_name\"].append(id_list[j].split('/')[1])\n",
    "    path = f'./data-task/task-{i+1}-{i+batch}.xlsx'\n",
    "    data_df = pd.DataFrame(data_batch)\n",
    "    data_df.to_excel(path)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 4900/4900 [00:00<00:00, 798201.40it/s]\n"
     ]
    }
   ],
   "source": [
    "# number, model_url\n",
    "import pandas as pd\n",
    "from tqdm import tqdm\n",
    "start_idx, end_idx = 100, 5000\n",
    "data_batch = {\n",
    "    \"number\": [],\n",
    "    \"model_url\": [],\n",
    "    \"model_name\": [],\n",
    "}\n",
    "for i in tqdm(range(start_idx, end_idx)):\n",
    "    number = i + 1\n",
    "    model_url = f\"https://huggingface.co/{id_list[i]}\"\n",
    "    data_batch[\"number\"].append(number)\n",
    "    data_batch[\"model_url\"].append(model_url)\n",
    "    data_batch[\"model_name\"].append(id_list[i].split('/')[1])\n",
    "path = f'./data-task/task-{start_idx+1}-{end_idx}.xlsx'\n",
    "data_df = pd.DataFrame(data_batch)\n",
    "data_df.to_excel(path)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "rag",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
